package com.ibeetl.dao.edao;

import com.ibeetl.dao.edao.entity.EdaoUser;
import io.edap.x.dao.DaoRegister;
import io.edap.x.dao.EntityDao;
import io.edap.x.dao.enums.DatabaseType;
import io.edap.x.dao.util.DaoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DaoConfig {

    @Autowired
    private DataSource ds;

    @Bean
    public EntityDao getEdaoUserDao() {
        EntityDao<EdaoUser> userDao = DaoRegister.instance().getEntityDao(EdaoUser.class, DatabaseType.MYSQL);
        userDao.setDataSource(ds);

        return userDao;
    }
}
